﻿using System;
using System.Collections.Generic;
using System.Data.Entity.ModelConfiguration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CubicFWNet.Data.Models.Mapping
{
    public class PurchaseComposeMap : EntityTypeConfiguration<PurchaseCompose>
    {
        public PurchaseComposeMap()
        {
            // Primary Key
            this.HasKey(t => t.Id);

            // Properties
            this.Property(t => t.Number)
                .HasMaxLength(64);

            this.Property(t => t.ProductName)
                .HasMaxLength(128);

            this.Property(t => t.CreatorName)
                .HasMaxLength(64);

            this.Property(t => t.FinanceNumber)
                .HasMaxLength(256);

            this.Property(t => t.Memo)
                .HasMaxLength(256);

            // Table & Column Mappings
            this.ToTable("PurchaseCompose");
            this.Property(t => t.Id).HasColumnName("Id");
            this.Property(t => t.Number).HasColumnName("Number");
            this.Property(t => t.ProductName).HasColumnName("ProductName");
            this.Property(t => t.ProductId).HasColumnName("ProductId");
            this.Property(t => t.Status).HasColumnName("Status");
            this.Property(t => t.Type).HasColumnName("Type");
            this.Property(t => t.SupplierId).HasColumnName("SupplierId");
            this.Property(t => t.Data).HasColumnName("Data");
            this.Property(t => t.CreatorId).HasColumnName("CreatorId");
            this.Property(t => t.CreatorName).HasColumnName("CreatorName");
            this.Property(t => t.CreateTime).HasColumnName("CreateTime");
            this.Property(t => t.ApplyTime).HasColumnName("ApplyTime");
            this.Property(t => t.ApplyId).HasColumnName("ApplyId");
            this.Property(t => t.StandardAmount).HasColumnName("StandardAmount");
            this.Property(t => t.Amount).HasColumnName("Amount");
            this.Property(t => t.ActualPrice).HasColumnName("ActualPrice");
            this.Property(t => t.Memo).HasColumnName("Memo");
            this.Property(t => t.ArrivalAmount).HasColumnName("ArrivalAmount");
            this.Property(t => t.ArrivalTime).HasColumnName("ArrivalTime");
            this.Property(t => t.ParentId).HasColumnName("ParentId");
            this.Property(t => t.OtherId).HasColumnName("OtherId");
            this.Property(t => t.FinanceNumber).HasColumnName("FinanceNumber");
            this.Property(t => t.PurchaseType).HasColumnName("PurchaseType");
            this.Property(t => t.CostPrice).HasColumnName("CostPrice").HasPrecision(18, 8);
        }
    }
}
